package com.example.yoga.mapper;

import com.example.yoga.entity.User;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.example.yoga.entity.VipCardVo;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Select;

import java.util.List;

/**
 * <p>
 *  Mapper 接口
 * </p>
 *
 * @author liwenkai
 * @since 2021-02-01
 */
@Mapper
public interface UserMapper extends BaseMapper<User> {

    @Select("SELECT card.cardNo,`user`.userName,user.userSex,card.balance FROM `card`,user_card,`user` WHERE card.cardId=user_card.cardId and user_card.userId=`user`.userId and `user`.roleId=3")
    List<VipCardVo> getAllVipCardList();

    @Select("SELECT COUNT(*) FROM `user`")
    int getTotalUser();
}
